package com.zansc.longd.controller;

import com.zansc.longd.domain.entity.s.Area;
import com.zansc.longd.model.base.bean.ResponseBean;
import com.zansc.longd.model.base.in.AreaIn;
import com.zansc.longd.service.s.AreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("area")
public class AreaController {
    
    @Autowired
    private AreaService areaService;
    
    @PostMapping("add")
    public ResponseBean add(AreaIn areaIn){
        int add = areaService.add(areaIn);
        return ResponseBean.success("插入成功");
    }
    
    @GetMapping("findAll")
    public ResponseBean findAll() {
        List<Area> all = areaService.findAll();
        return ResponseBean.success(all);
    }
    
    @GetMapping("findAll111")
    public ResponseBean findAll111() {
        List<AreaIn> all = areaService.findAll1111();
        return ResponseBean.success(all);
    }
    
}
